<template>
	<view class="pop-promot-box" catchtap="hidePromptbox">
		<view class="pop-promot-back" catchtap="return">
			<view class="pop-promot-title" v-if="errorWordSwitch">每日生词打卡数量</view>
			<view class="pop-promot-title" v-else>提示</view>
			<picker class="pickerClass"
				@change="radioChange" :range="newWordNumList" v-if="errorWordSwitch" range-key="errorWordNum" :value="errorWordNumIndex">
				<view class="apply-line-select" >
					{{errorWordNumStr}}个
					<view class="right-icon"></view>
				</view>
			</picker>
			<text class="pop-promot-count">{{msg}}</text>
			<view class="pop-promot-bottomView">
				<button class="bottom-leftbtn defineButton" @click="turnToplayGame">{{confirmTitle}}</button>
				<button class="bottom-leftbtn cancelButton" @click="hidePromptbox">{{cancelTitle}}</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "beePlanNewWordNumber",
		props: {
			confirmTitle: {
				type: String,
			},
			cancelTitle: {
				type: String,
			},
			msg: {
				type: String,
			},
			errorWordSwitch: {
				type: Boolean,
			},
		},
		data() {
			return {
				errorWordNumIndex: 0,
				newWordNumList: [{
						'errorWordNum': '5'
					},
					{
						'errorWordNum': '10'
					},
					{
						'errorWordNum': '15'
					},
					{
						'errorWordNum': '20'
					},
					{
						'errorWordNum': '25'
					},
					{
						'errorWordNum': '30'
					},
					{
						'errorWordNum': '35'
					},
					{
						'errorWordNum': '40'
					},
					{
						'errorWordNum': '45'
					},
					{
						'errorWordNum': '50'
					},
				],
				errorWordNumStr: '5',
			};
		},
		methods: {
			return: function() {},
			radioChange: function(e) {
				console.log('e', e);
				this.errorWordNumIndex = e.detail.value,
				this.errorWordNumStr = this.newWordNumList[e.detail.value].errorWordNum
			},
			hidePromptbox: function(e) {
				this.$emit('cancel');
			},
			turnToplayGame: function(e) {
				this.$emit('confirm', {
					'errorWordNum': this.newWordNumList[this.errorWordNumIndex].errorWordNum
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pop-promot-box {
		width: 100%;
		height: 100%;
		position: fixed;
		background-color: rgba(0, 0, 0, 0.5);
		z-index: 10000;
		top: 0;
		left: 0;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.pop-promot-back {
		padding: 30rpx;
		width: 80%;
		margin: 0 10%;
		border-radius: 20rpx;
		background-image: url(https://cdn.spbcn.org/spbcnWechat/pop-content-back.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
		background-color: var(--themeColor);
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.pop-promot-title {
		font-size: 40rpx;
		color: white;
		margin: 30rpx;
		text-align: center;
		margin-bottom: 35rpx;
		font-family: 'hzgb';
		text-shadow: -1px 1px 0 #992722, 1px 1px 0 #992722, 1px -1px 0 #992722, -1px -1px 0 #992722;
		-webkit-text-stroke: 1px #992722;
	}

	.pop-promot-count {
		font-size: 24rpx;
		color: black;
		text-align: center;
		font-weight: 600;
		padding: 20rpx;
		border-radius: 20rpx;
		margin-top: 10rpx;
	}

	.backColor {
		background-color: white;
	}

	.pop-promot-bottomView {
		width: 100%;
		height: 60rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		margin-top: 30rpx;
	}

	.bottom-leftbtn {
		width: 200rpx;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 30rpx;
		font-size: 26rpx;
		text-align: center;
		// font-weight: 800;
	}

	.defineButton {
		color: white;
		background: linear-gradient(#fc823d, #fa3748);
	}

	.cancelButton {
		color: black;
		background-color: gray;
	}

	.pickerClass {
		width: 100%;
	}

	.apply-line-select {
		width: 70%;
		margin: 20px 15%;
		height: 40px;
		line-height: 40px;
		border-radius: 6px;
		text-align: center;
		background-color: white;
		font-size: 15px;
		font-weight: 900;
		border: 1px solid #000;
		position: relative;
	}

	.bottom-button {
		width: 90px;
		height: 30px;
		line-height: 30px;
		border-radius: 8px;
		text-align: center;
		color: white;
		background-color: black;
		font-size: 14px;
		font-weight: 900;
		margin-bottom: 20px;
	}

	.right-icon {
		width: 0;
		height: 0;
		border-width: 12px 11px 0px;
		border-style: solid;
		border-color: black transparent transparent;
		right: 10px;
		top: 14px;
		position: absolute;
	}
</style>